package com.shu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shu.dao.SysUserMapper;
import com.shu.entity.SysUser;
import com.shu.entity.SysUserExample;
import com.shu.service.SysUserService;
import com.shu.util.CollectionUtils;

@Service
public class SysUserServiceImpl implements SysUserService {
	
	@Autowired
	private SysUserMapper userMapper;

	@Override
	public List<SysUser> list(SysUserExample example, int offset, int limit) {
		return userMapper.selectByExample(example);
	}

	@Override
	public SysUser getUser(String username) {
		SysUserExample userExample = new SysUserExample();
		userExample.createCriteria().andUsernameEqualTo(username);
		return (SysUser) CollectionUtils.getFirstElement(userMapper.selectByExample(userExample));
	}


}
